package com.base.myproject.fileCenter;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.Date;

import com.base.myproject.server.database.PoolMan;

/**
 * @author cxghiu410@gmail.com
 *	这个类主要对hr_docCenter进行操作。
 */
public class JDBCToFile {

	private Connection conn = null;
	private PreparedStatement pstmt;
	
	public void addImages(String fullPath,Date uploadTime,String fileName,String classNo,String showPathUrl,String showFileName){
		try {
			conn = DB.getConnection();
			pstmt = conn.prepareStatement("insert into hr_docCenter (fileName,path,uploadTime,classNo,showPathUrl,showFileName) values (?,?,?,?,?,?)");
			pstmt.setString(1,fileName);
			pstmt.setString(2, fullPath);
			pstmt.setTimestamp(3, new Timestamp(uploadTime.getTime()));
			pstmt.setString(4, classNo);
			pstmt.setString(5, showPathUrl);
			pstmt.setString(6, showFileName);
			pstmt.executeUpdate();
			
		//	conn.close();
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
				try {
					if(pstmt != null) pstmt.close();
					if(conn != null) conn.close();
				} catch (SQLException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
		}
	}

}
